package cn.yunhe.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.yunhe.model.Person;

@Controller
public class JsonController {
	
	@RequestMapping("/get")
	@ResponseBody
	public String getPerson(){
		return "person";
	}
	
	@RequestMapping("/myperson")
	@ResponseBody
	public Person myPerson(){
		Person p=new Person();
		p.setId(1);
		p.setName("zhangsans");
		return p;
	}
	
/*	@RequestMapping("/requestperson")
	@ResponseBody
	public Person myPerson(Person person){
		Person p=new Person();
		p.setId(1);
		p.setName("zhangsan");
		return p;
	}
	
	@RequestMapping(value="/requestperson",method=RequestMethod.POST)
	@ResponseBody
	public Person myPerson(@RequestBody Person person){
		Person p=new Person();
		p.setId(1);//postman
		p.setName("zhangsan");
		return p;
	}*/
	
	
	
	@RequestMapping("/{id}/delete")
	public String delete(@PathVariable int id){
		System.out.println("delete--"+id);
		return "success";
	}

	
}
